/******************************************************************************
** 
** Digits, spaces and other symbols counter.
** 
** File name:	count_digits.c
** Compilation:	cc count_digits.c -o count_digits
** Execution:	./count_digits
** 
** Description:
** Program reads the input counts the number of each digit, number of spaces 
** (' ', '\t' and '\n' are treated as "space") and number of other symbols.
** 
******************************************************************************/
#include <stdio.h>

int c, i, nspaces, nother;
int ndigits[10];

main()
{
    nspaces = nother = 0;
    for (i=0; i<=9; ++i) {
      ndigits[i] = 0;
    }
    
    while((c=getchar()) != EOF) {
      if (c >= '0' && c <= '9') {
        ++ndigits[c-'0'];
      } else if (c == ' ' || c == '\t' || c == '\n') {
        ++nspaces;
      } else {
        ++nother;
      }
    }
    printf("\nNumber of digits: ");
    for (i=0; i<=9; ++i) {
      printf("%d=%d ", i, ndigits[i]);
    }
    printf("\nNumber of spaces: %d\n", nspaces);
    printf("Number of other symbols: %d\n", nother);
}

